//
//  DepoistBackCell.swift
//  d11
//
//  Created by peale on 2018/10/20.
//  Copyright © 2018年 Tech_001. All rights reserved.
//

import UIKit
typealias BackToSuperPageBlock = () -> Void
class DepoistBackCell: UITableViewCell {
    var  backBtn :UIButton?
    var backToSuperPageBlock: BackToSuperPageBlock?
    func callInClickBlock(_ block: @escaping BackToSuperPageBlock) {
        
        backToSuperPageBlock = block
    }
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.setUpUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    func setUpUI() -> Void {
        self.backgroundColor  = UIColor.clear
        self.selectionStyle = UITableViewCell.SelectionStyle.none
        
        self.backBtn = UIButton.init(type: .custom)
        self.backBtn?.layer.masksToBounds = true
        self.backBtn?.layer.cornerRadius = 5
        self.backBtn?.backgroundColor = UIColor.white
        self.backBtn?.layer.borderWidth = 1
        self.backBtn?.titleLabel?.font = UIFont.systemFont(ofSize: 17)
        self.backBtn?.layer.borderColor = HexRGBAlpha(0xFFC873, 1).cgColor
        self.backBtn?.setTitleColor(HexRGBAlpha(0xFFC873, 1),for: .normal)
        self.backBtn?.setTitle("返回重新选择存款方式", for: .normal)
        self.contentView.addSubview(self.backBtn!)
        self.backBtn?.addTarget(self, action: #selector(self.actionToClick), for: .touchUpInside)
        self.backBtn?.snp.makeConstraints{(make) in
            make.centerX.equalToSuperview()
            make.width.equalTo(200)
            make.top.equalTo(10)
            make.height.equalTo(40)
        }
    }
    @objc func actionToClick() -> Void {
        if backToSuperPageBlock != nil {
            backToSuperPageBlock!()
        }
    }
}
